#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
void maopao(int* arr, int n)
{
    int* n1 = arr;
    int* n2 = arr + 1;
    while (n2 != arr + n)
    {
        if (*n1 > *n2)
        {
            int tmp = *n1;
            *n1 = *n2;
            *n2 = tmp;
        }
        n1++;
        n2++;
    }
}
int main()
{
    int n = 0;
    int k = 0;
    int i = 0;
    scanf("%d %d", &n, &k);
    int arr[100] = { 0 };
    for (i = 0; i < n; i++)
    {
        scanf("%d", &arr[i]);
    }
    while (k--)
    {
        maopao(arr, n);
    }
    i = 0;
    for (i = 0; i < n; i++)
    {
        printf("%d", arr[i]);
        if (i < n - 1)
        {
            printf(" ");
        }
    }
    return 0;
}